//从服务器主动发送请求调用接口 删除数据
const http = require('http')
const queryString = require("querystring")

options = {
    hostname: 'localhost',
    port: 3000,
    protocol: "http:",
    path: '/books/book',
    header: {
        'Content-Type': 'application/x-www/form-urlencoded'
    },
    method: 'delete'   //默认get
}

let req = http.request(options, (res)=>{
    let info = ''
    res.on('data', (chunk)=>{
        info += chunk
        console.log(info)
    })
    res.on('end', ()=>{
        console.log("删除图书")
    })
})

req.end()